home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d1
/
joymouse.arc
/
JOYBIOS.ASM
< prev
next >
Wrap
Assembly Source File
|
1985-07-18
|
1KB
|
73 lines
stack segment para stack 'stack'
db 128 dup(?) ;needed only for clean assemble
stack ends
int60s segment para public 'code'
int60 proc far
assume cs:int60s,ss:stack
; establish interrupt 60 vector (this is the joystick interrupt)
mov dx,offset int_60
add dx,100H
mov ax,2560H
int 21H
; terminate and stay resident
mov dx,offset end60
add dx,100H
int 27H
; interrupt 60 - request joystick data to ds:dx
int_60: push ax ;save environment
push bx
push cx
push dx
push si
;
mov si,dx ;set up parameters to talk to joystick
mov bx,000fh
mov cx,0101h
mov dx,0201h
;
cli ;start joystick conversation
out dx,al
NEXTIN:
in al,dx
and al,0fh ;look at all joystick data
cmp al,bl
loopz NEXTIN
jcxz STOPIN ;nothing else to look at
xor al,bl
mov ah,cl
push ax ;save joystick count
inc bh
xor bl,al
jmp NEXTIN
STOPIN: sti ;noting else to look at
;
or bh,bh
jz EXIT
mov dl,bh
OTHER:
mov bx,si ;calculate joystick value
mov cx,4
pop ax
not ah
add ah,dl
NEXT:
shr al,1
jnb NOSAVE
mov ¢bx|,ah ;save joystick data at ds:dx +
NOSAVE:
inc bx
loop NEXT
dec dl
jnz OTHER
EXIT:
pop si ;restore environment, back to caller
pop dx
pop cx
pop bx
pop ax
iret
end60 db 0
int60 endp
int60s ends
end int60